package com.deyuanyun.pic.wf.service.impl;

import com.deyuanyun.pic.wf.domain.ProcessInstance;
import com.deyuanyun.pic.wf.domain.ProcessInstanceExample;
import com.deyuanyun.pic.wf.mapper.ProcessInstanceMapper;
import com.deyuanyun.pic.wf.service.ProcessInstanceService;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProcessInstanceServiceImpl implements ProcessInstanceService {
    @Autowired
    private ProcessInstanceMapper processInstanceMapper;

    private static final Logger logger = LoggerFactory.getLogger(ProcessInstanceServiceImpl.class);

    public ProcessInstance selectByPrimaryKey(String id) {
        return this.processInstanceMapper.selectByPrimaryKey(id);
    }

    public int deleteByPrimaryKey(String id) {
        return this.processInstanceMapper.deleteByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(ProcessInstance record) {
        return this.processInstanceMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(ProcessInstance record) {
        return this.processInstanceMapper.updateByPrimaryKey(record);
    }

    public int insert(ProcessInstance record) {
        return this.processInstanceMapper.insert(record);
    }

    public List<ProcessInstance> queryProcessInstanceByDefinitionId(String definitionId){

        ProcessInstanceExample processInstanceExample = new ProcessInstanceExample();
        processInstanceExample.createCriteria().andDeletedEqualTo((short)0).andDefinitionIdEqualTo(definitionId);
        List<ProcessInstance> list = processInstanceMapper.selectByExample(processInstanceExample);
        return list;
    }
}